//
//  YGSelfTestBLL.m
//  yuanshangyiliao
//
//  Created by icholab on 2021/4/27.
//

#import "YGSelfTestBLL.h"
#import "CNHTTPManager.h"
#import "YGMedicalModel.h"
@implementation YGSelfTestBLL

+(void)requestMedicalWithAge:(NSString *)age
                         sex:(NSString *)sex
                     stature:(NSString *)stature
                      weight:(NSString *)weight
                     Success:(void (^)(YGMedicalModel *model))success
                            fail:(void (^)(NSError *error))fail{
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    [dic fa_setObjectSafe:age forKey:@"age"];
    [dic fa_setObjectSafe:sex forKey:@"sex"];
    [dic fa_setObjectSafe:stature forKey:@"stature"];
    [dic fa_setObjectSafe:weight forKey:@"weight"];

    [[CNHTTPManager shared] GET:YG_Medical_URL parameters:dic success:^(id responeObj) {
            NSDictionary *data = [responeObj objectForKey:@"data"];
        YGMedicalModel *model = [[YGMedicalModel alloc] initWithDictionary:data error:nil];
        if (success) {
            success(model);
        }
        } failure:^(NSError *error, NSString *errorDes) {
            if (fail) {
                fail(error);
            }
        }];
}
@end
